// models/role_permission.go
package models

import (
	"time"

	"gorm.io/gorm"
)

// RolePermission 角色与权限的关联模型（多对多）
type RolePermission struct {
	ID           uint           `gorm:"primaryKey" json:"id"`
	CreatedAt    time.Time      `json:"created_at"`
	UpdatedAt    time.Time      `json:"updated_at"`
	DeletedAt    gorm.DeletedAt `gorm:"index" json:"-"`
	RoleID       uint           `gorm:"index" json:"role_id"`       // 角色ID
	PermissionID uint           `gorm:"index" json:"permission_id"` // 权限ID
	Role         Role           `gorm:"foreignKey:RoleID" json:"role,omitempty"`
	Permission   Permission     `gorm:"foreignKey:PermissionID" json:"permission,omitempty"`
}
